home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF)))) SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF))))
-
-
-
- NNNNAAAAMMMMEEEE
- setbuf, setvbuf, setbuffer, setlinebuf - assign buffering to a stream
- logical unit
-
- FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
-
- cccchhhhaaaarrrraaaacccctttteeeerrrr ****((((BBBBUUUUFFFFSSSSIIIIZZZZ++++8888)))) bbbbuuuuffff
- iiiinnnntttteeeeggggeeeerrrr ttttyyyyppppeeee,,,, ssssiiiizzzzeeee,,,, sssseeeettttbbbbuuuuffff,,,, sssseeeettttvvvvbbbbuuuuffff,,,, sssseeeettttbbbbuuuuffffffffeeeerrrr,,,,
-
- sssseeeettttbbbbuuuuffff ((((lllluuuunnnn,,,, bbbbuuuuffff))))
-
- sssseeeettttvvvvbbbbuuuuffff ((((lllluuuunnnn,,,, bbbbuuuuffff,,,, ssssiiiizzzzeeee))))
-
- sssseeeettttbbbbuuuuffffffffeeeerrrr ((((lllluuuunnnn,,,, bbbbuuuuffff,,,, ssssiiiizzzzeeee))))
-
- sssseeeettttlllliiiinnnneeeebbbbuuuuffff ((((lllluuuunnnn))))
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
-
- vvvvooooiiiidddd sssseeeettttbbbbuuuuffff ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, cccchhhhaaaarrrr ****bbbbuuuuffff))));;;;
-
- iiiinnnntttt sssseeeettttvvvvbbbbuuuuffff ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, cccchhhhaaaarrrr ****bbbbuuuuffff,,,, iiiinnnntttt ttttyyyyppppeeee,,,, ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee))));;;;
-
- iiiinnnntttt sssseeeettttbbbbuuuuffffffffeeeerrrr ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, cccchhhhaaaarrrr ****bbbbuuuuffff,,,, iiiinnnntttt ssssiiiizzzzeeee))));;;;
-
- iiiinnnntttt sssseeeettttlllliiiinnnneeeebbbbuuuuffff ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The three types of buffering available are unbuffered, fully buffered,
- and line buffered. When an output stream unit is unbuffered, information
- appears on the destination file or terminal as soon as written; when it
- is fully buffered many characters are saved up and written as a block;
- when it is line buffered characters are saved up until a newline is
- encountered or input is read from stdin. _F_f_l_u_s_h(3S) _f_l_u_s_h(3F) may be
- used to force the block out early. By default, output to a terminal is
- line buffered and all other input/output is fully buffered.
-
- _S_e_t_b_u_f may be used after a stream unit has been opened but before it is
- read or written. It causes the array pointed to by _b_u_f to be used
- instead of an automatically allocated buffer. If _b_u_f is the NULL pointer
- input/output will be completely unbuffered. If _b_u_f is not the NULL
- pointer and the indicated _s_t_r_e_a_m _l_u_n is open to a terminal, output will
- be line buffered.
-
- A constant BBBBUUUUFFFFSSSSIIIIZZZZ,,,, defined in the <<<<ssssttttddddiiiioooo....hhhh>>>> header file, indicates the
- assumed minimum length of _b_u_f. It is wise to allocate a few words of
- extra space for _b_u_f, to allow for any synchronization problems resulting
- from signals occurring at inopportune times. A good choice (and the one
- used by default in _s_t_d_i_o(3s)) is
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF)))) SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF))))
-
-
-
- char buf[BUFSIZ + 8]; character *(BUFSIZ + 8) buf
-
- _S_e_t_v_b_u_f may be used after a stream unit has been opened but before it is
- read or written. _T_y_p_e determines how _s_t_r_e_a_m _l_u_n will be buffered. Legal
- values for _t_y_p_e (defined in <<<<ssssttttddddiiiioooo....hhhh>>>>) are:
-
- _IOFBF causes input/output to be fully buffered.
-
- _IOLBF causes output to be line buffered; the buffer will be flushed
- when a newline is written, the buffer is full, or input is
- requested.
-
- _IONBF causes input/output to be completely unbuffered.
-
- If input/output is unbuffered, _b_u_f and _s_i_z_e are ignored. For buffered
- input/output, if _b_u_f is not the NULL pointer and _s_i_z_e is greater than
- eight, the array it points to will be used for buffering. In this case,
- _s_i_z_e specifies the length of this array. The actual buffer will consist
- of the first _s_i_z_e-8 bytes of _b_u_f (see the discussion of BBBBUUUUFFFFSSSSIIIIZZZZ above).
- If _b_u_f is the NULL pointer, or _s_i_z_e is less than eight, space will be
- allocated to accommodate a buffer. This buffer will be of length BBBBUUUUFFFFSSSSIIIIZZZZ....
- (The actual space allocated will be eight bytes longer.)
-
- _S_e_t_b_u_f_f_e_r and _s_e_t_l_i_n_e_b_u_f are provided for compatibility with 4.3BSD.
- _S_e_t_b_u_f_f_e_r, an alternate form of _s_e_t_b_u_f, is used after a stream unit has
- been opened but before it is read or written. The character array _b_u_f
- whose size is determined by the _s_i_z_e argument is used instead of an
- automatically allocated buffer. If _b_u_f is the constant pointer NNNNUUUULLLLLLLL,
- input/output will be completely unbuffered.
-
- _S_e_t_l_i_n_e_b_u_f is used to change _s_t_d_o_u_t or _s_t_d_e_r_r from fully buffered or
- unbuffered to line buffered. Unlike the other routines, it can be used
- at any time that the file descriptor is active.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- fopen(3S), fflush(3S), getc(3S), malloc(3C), putc(3S), stdio(3S).
- flush(3F), perror(3F).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Success is indicated by _s_e_t_v_b_u_f and _s_e_t_b_u_f_f_e_r returning zero. a zero
- return value. A non-zero return value indicates an error. The value of
- _e_r_r_n_o can be examined to determine the cause of the error. If it is
- necessary to allocate a buffer and the attempt is unsuccessful, _s_e_t_v_b_u_f
- and _s_e_t_b_u_f_f_e_r return a non-zero value. _S_e_t_v_b_u_f will also return non-zero
- if the value of _t_y_p_e is not one of _IONBF, _IOLBF, or _IOFBF.
-
- NNNNOOOOTTTTEEEESSSS
- A common source of error is allocating buffer space as an ``automatic''
- variable in a code block, and then failing to close the stream unit in
- the same block.
-
- These functions cannot be used on direct unformatted units.
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF)))) SSSSEEEETTTTBBBBUUUUFFFF((((3333FFFF))))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
-